package com.stu.design_patterns.singleton;
// 饿汉式（基于类加载机制避免了多线程的同步问题）
public class Singleton01Hungry {
  private static Singleton01Hungry singleton = new Singleton01Hungry();
  private Singleton01Hungry() {}
  // 单例方法：职责为获取实例
  public static Singleton01Hungry getInstance() {
    return singleton;
  }
  // 功能方法：职责为其它
  public void say() { System.out.println("饿汉式"); }
}
